#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>

int main()
{
  int ret = fork();
  if(ret == 0)
  {
    //child
    printf("i am child pid :%d   ret = %d\n",getpid(),ret);
    sleep(5);
    printf("pid:%d  ret:%d\n",getppid(),ret);
    while(1);
  }
  else if(ret > 0)
  {
    //parent
    printf("i am parent pid :%d   ret = %d\n",getpid(),ret);
    
  }
  else 
  {
    perror("fork");
    return -1;
  }
  sleep(1);
  return 0;
}
